FROM centos
MAINTAINER hz7726
ENV mysql_version="5.7.27-linux-glibc2.12" \
    mysql_dir=/data/mysql \
    mysql_user=mysql 
COPY ./mysql-5.7.27-linux-glibc2.12-x86_64.tar.gz /usr/local/mysql-5.7.27-linux-glibc2.12-x86_64.tar.gz
RUN yum makecache \
 && yum install libaio wget tar numactl -y \
#&& wget  http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-${mysql_version}-x86_64.tar.gz \
#&& mv mysql-${mysql_version}-x86_64.tar.gz /usr/local \
 && yum clean all \
 && tar xf /usr/local/mysql-${mysql_version}-x86_64.tar.gz -C /usr/local \
 && rm -fr /usr/local/mysql-${mysql_version}-x86_64.tar.gz \
 && cd /usr/local \
 && mv mysql-5.7.27-linux-glibc2.12-x86_64 mysql \
 && groupadd -r -g 1001 ${mysql_user} \
 && useradd -r -g 1001 -u 306 ${mysql_user} \
 && mkdir -p /data/mysql \
 && chown -R mysql:mysql /data/mysql \
 && chown -R root:mysql /usr/local/mysql 
WORKDIR /usr/local/mysql
RUN ./bin/mysqld --initialize-insecure  --user=mysql --basedir=/usr/local/mysql  --datadir=/data/mysql > a.txt \
 && rm -rf /data/mysql 
ENV PATH /usr/local/mysql/bin:$PATH
EXPOSE 3306/tcp
ENTRYPOINT  ./bin/mysqld_safe
